/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.mes.base.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.tool.api.R;
import org.springblade.modules.mes.base.entity.DictTreeNode;
import org.springblade.modules.mes.base.entity.MaterialInfo;
import org.springblade.modules.mes.base.vo.MaterialInfoVO;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 材料信息（材料库） 服务类
 *
 * @author BladeX
 * @since 2020-09-14
 */
public interface IMaterialInfoService extends BaseService<MaterialInfo> {

	/**
	 * 自定义分页
	 *
	 * @param page
	 * @param materialInfo
	 * @return
	 */
	IPage<MaterialInfoVO> selectMaterialInfoPage(IPage<MaterialInfoVO> page, MaterialInfoVO materialInfo);

	/**
	 * 不分页
	 * @param materialInfo
	 * @return
	 */
	List<MaterialInfoVO> selectMaterialInfoList(MaterialInfoVO materialInfo);

	/**
	 * 根据材料名称模糊搜索原材料
	 * @param materialInfo
	 * @return
	 */
	List<MaterialInfoVO> selectRawMaterialList(MaterialInfoVO materialInfo);

	/**
	 * 根据更新时间查询材料列表，包含已删除的
	 * @param startTime
	 * @param endTime
	 * @return
	 */
	List<MaterialInfo> listWithDeleted(Date startTime, Date endTime);

    List<MaterialInfoVO> materialList(MaterialInfoVO materialInfo);

    /**
     * 获取产品/物料信息
     * @param materialInfo
     * @return
     */
    R getMaterialInfo(MaterialInfoVO materialInfo);

    IPage<MaterialInfoVO> getQuaMaterialInfoPage(IPage<MaterialInfoVO> page, MaterialInfoVO materialInfo);


    List<MaterialInfo> getMaterialInfos();

	List<MaterialInfoVO> getMaterialLists(MaterialInfoVO materialInfo);

    R importMaterialInfo(Map<String, Object> map);

	void exportMaterialInfo(HttpServletRequest request, HttpServletResponse response, MaterialInfoVO materialInfo, String ids);

    R getMaterialInfoByQuality(MaterialInfoVO materialInfo);

    List<MaterialInfoVO> fisMaterialList(MaterialInfoVO materialInfo);

    List<MaterialInfo> materialListByIdList(List<Long> longList);

	void deriveMaterial(MaterialInfoVO materialInfo, String ids, HttpServletRequest request, HttpServletResponse response);

    List<MaterialInfo> materialListByNoList(List<String> materialNoList);

    R<List<MaterialInfo>> getMaterialInfoByPatrol(MaterialInfoVO materialInfo);

	List<DictTreeNode> getTree(String code, String dictKey);

}
